package com.ymatou.iapi.coupon.testcase;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.coupon.parameter.CouponDto;
import com.ymatou.iapi.coupon.parameter.getProductAvailablePlatformCouponNumBean;
import com.ymatou.iapi.coupon.service.getProductAvailablePlatformCouponNumCall;
import com.ymatou.iapi.couponmanage.parameter.CreateCouponBean;
import com.ymatou.iapi.couponmanage.service.CreateCouponCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CouponServiceCallServiceV2;
import com.ymttest.business.service.CouponServiceMCallServiceV2;
import com.ymttest.utils.TestDataManager;
/**
*获取商品可用的平台优惠券数量
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_getProductAvailablePlatformCouponNum{
	private static getProductAvailablePlatformCouponNumBean getproductavailableplatformcouponnumBean;
	private static getProductAvailablePlatformCouponNumCall getproductavailableplatformcouponnumCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取商品可用的平台优惠券数量");
	}

	@Before
	public void caseUp() {
		getproductavailableplatformcouponnumBean=new getProductAvailablePlatformCouponNumBean();
		getproductavailableplatformcouponnumCall=new getProductAvailablePlatformCouponNumCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getproductavailableplatformcouponnumCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_001() {
		Logger.start(true,"获取商品可用的平台优惠券数量");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();

			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			String productId = TestDataManager.getRandomNum(8);
			 List<String> productIds = new ArrayList<String>();
			 productIds.add(productId);
			 productIds.add("qaffsfsewrwer");
			 productIds.add("qaffsfswerwqerqwrqw");
	            createcouponBean.setProductIds(productIds);

			CreateCouponCall createCouponCall = couponCallService.createPlatformCoupon(createcouponBean);
			
			Thread.sleep(3000);
			
			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall.getBatchCode(), userId);
			
			Thread.sleep(5*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
						
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(1,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_002() {
		Logger.start(true,"获取商品可用的平台优惠券数量-多张可聚合券");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();

			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			String productId = TestDataManager.getRandomNum(8);
			 List<String> productIds = new ArrayList<String>();
			 productIds.add(productId);
			 productIds.add("qaffsfsewrwer");
			 productIds.add("qaffsfswerwqerqwrqw");
	            createcouponBean.setProductIds(productIds);

			CreateCouponCall createCouponCall1 = couponCallService.createPlatformCoupon(createcouponBean);
			CreateCouponCall createCouponCall2 = couponCallService.createPlatformCoupon(createcouponBean);

			Thread.sleep(3000);
			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode1 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall1.getBatchCode(), userId);
			String couponCode2 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall2.getBatchCode(), userId);

			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(2,result.get("quantity").getAsInt(), "验证返回quantity");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_003() {
		Logger.start(true,"获取商品可用的平台优惠券数量-优惠券可用面额不等不聚合");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();

			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			String productId = TestDataManager.getRandomNum(8);
			 List<String> productIds = new ArrayList<String>();
			 productIds.add(productId);
			 productIds.add("qaffsfsewrwer");
			 productIds.add("qaffsfswerwqerqwrqw");
	            createcouponBean.setProductIds(productIds);

			CreateCouponCall createCouponCall1 = couponCallService.createPlatformCoupon(createcouponBean);
			
			CreateCouponBean createcouponBean2 = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			createcouponBean2.setProductIds(productIds);
			createcouponBean2.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(5));
			CreateCouponCall createCouponCall2 = couponCallService.createPlatformCoupon(createcouponBean2);

			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode1 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall1.getBatchCode(), userId);
			String couponCode2 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall2.getBatchCode(), userId);

			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(2,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_004() {
		Logger.start(true,"获取商品可用的平台优惠券数量-优惠券使用面额不等不聚合");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();
    
			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			
			String productId = TestDataManager.getRandomNum(8);
			 
			List<String> productIds = new ArrayList<String>();
			productIds.add(productId);
			productIds.add("qaffsfsewrwer");
			productIds.add("qaffsfswerwqerqwrqw");
	        
			 createcouponBean.setProductIds(productIds);

			CreateCouponCall createCouponCall1 = couponCallService.createPlatformCoupon(createcouponBean);
			
			CreateCouponBean createcouponBean2 = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			createcouponBean2.setProductIds(productIds);
			createcouponBean2.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(150));
			CreateCouponCall createCouponCall2 = couponCallService.createPlatformCoupon(createcouponBean2);

			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode1 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall1.getBatchCode(), userId);
			String couponCode2 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall2.getBatchCode(), userId);

			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(2,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_005() {
		Logger.start(true,"获取商品可用的平台优惠券数量-优惠券限制条件不等不聚合");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();
    
			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			
			String productId = TestDataManager.getRandomNum(8);
			 
			List<String> productIds = new ArrayList<String>();
			productIds.add(productId);
			productIds.add("qaffsfsewrwer");
			productIds.add("qaffsfswerwqerqwrqw");
	        
			 createcouponBean.setProductIds(productIds);
			 
			List<Integer> categories = new ArrayList<>();
			
			categories.add(123);
			createcouponBean.setCategories(categories);

			CreateCouponCall createCouponCall1 = couponCallService.createPlatformCoupon(createcouponBean);
			
			CreateCouponBean createcouponBean2 = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			createcouponBean2.setProductIds(productIds);
			createcouponBean2.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(150));
			CreateCouponCall createCouponCall2 = couponCallService.createPlatformCoupon(createcouponBean2);

			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode1 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall1.getBatchCode(), userId);
			String couponCode2 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall2.getBatchCode(), userId);

			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(123);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(2,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	public void Tc_getProductAvailablePlatformCouponNum_006() {
		Logger.start(true,"获取商品可用的平台优惠券数量-优惠券使用结束时间不等不聚合");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();
    
			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			
			String productId = TestDataManager.getRandomNum(8);
			 
			List<String> productIds = new ArrayList<String>();
			productIds.add(productId);
			productIds.add("qaffsfsewrwer");
			productIds.add("qaffsfswerwqerqwrqw");
	        
		    createcouponBean.setProductIds(productIds);
			 
			Calendar calendar2 = Calendar.getInstance(); // 得到日历
			calendar2.setTime(new Date());// 把当前时间赋给日历
			calendar2.add(Calendar.DAY_OF_MONTH, 3); // 设置为后十天
			Date dAfter = calendar2.getTime(); // 得到前一天的时间

			createcouponBean.setValidEnd(dAfter);
			
			CreateCouponCall createCouponCall1 = couponCallService.createPlatformCoupon(createcouponBean);
			
			CreateCouponBean createcouponBean2 = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			createcouponBean2.setProductIds(productIds);
			createcouponBean2.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(150));
			CreateCouponCall createCouponCall2 = couponCallService.createPlatformCoupon(createcouponBean2);

			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode1 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall1.getBatchCode(), userId);
			String couponCode2 = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall2.getBatchCode(), userId);

			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(2,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_007() {
		Logger.start(true,"获取商品可用的平台优惠券数量-UserType空");
		try {
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			//getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(122);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(233);
			getproductavailableplatformcouponnumBean.setProductCode("dsfgdfg");       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
  			Logger.verifyEquals("1",getproductavailableplatformcouponnumCall.getString("statusCode"), "验证返回code");
  			Logger.verifyIsContains("userType must 1 or 2",getproductavailableplatformcouponnumCall.getString("message"), "验证返回message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_008() {
		Logger.start(true,"获取商品可用的平台优惠券数量-UserId空");
		try {
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			//getproductavailableplatformcouponnumBean.setUserId(122);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(233);
			getproductavailableplatformcouponnumBean.setProductCode("dsfgdfg");       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
  			Logger.verifyEquals("1",getproductavailableplatformcouponnumCall.getString("statusCode"), "验证返回code");
  			Logger.verifyIsContains("userId must",getproductavailableplatformcouponnumCall.getString("message"), "验证返回message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_009() {
		Logger.start(true,"获取商品可用的平台优惠券数量-CategoryIds空");
		try {
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(122);
			//getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(233);
			getproductavailableplatformcouponnumBean.setProductCode("dsfgdfg");       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
  			Logger.verifyEquals("1",getproductavailableplatformcouponnumCall.getString("statusCode"), "验证返回code");
  			Logger.verifyIsContains("categoryIds size is must equals 3",getproductavailableplatformcouponnumCall.getString("message"), "验证返回message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_010() {
		Logger.start(true,"获取商品可用的平台优惠券数量-PlatformId空");
		try {
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(122);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			//getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(233);
			getproductavailableplatformcouponnumBean.setProductCode("dsfgdfg");       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
  			Logger.verifyEquals("1",getproductavailableplatformcouponnumCall.getString("statusCode"), "验证返回code");
  			Logger.verifyIsContains("platformId must",getproductavailableplatformcouponnumCall.getString("message"), "验证返回message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_011() {
		Logger.start(true,"获取商品可用的平台优惠券数量-CountryId空");
		try {
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(122);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			//getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(233);
			getproductavailableplatformcouponnumBean.setProductCode("dsfgdfg");       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
  			Logger.verifyEquals("0",getproductavailableplatformcouponnumCall.getString("statusCode"), "验证返回code");
//  			Logger.verifyIsContains("countryId must",getproductavailableplatformcouponnumCall.getString("message"), "验证返回message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_012() {
		Logger.start(true,"获取商品可用的平台优惠券数量-SellerId空");
		try {
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(122);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			//getproductavailableplatformcouponnumBean.setSellerId(233);
			getproductavailableplatformcouponnumBean.setProductCode("dsfgdfg");       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
  			Logger.verifyEquals("1",getproductavailableplatformcouponnumCall.getString("statusCode"), "验证返回code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_013() {
		Logger.start(true,"获取商品可用的平台优惠券数量-ProductCode空");
		try {
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(122);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(233);
			//getproductavailableplatformcouponnumBean.setProductCode("dsfgdfg");       

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
			
  			Logger.verifyEquals("1",getproductavailableplatformcouponnumCall.getString("statusCode"), "验证返回code");
  			Logger.verifyIsContains("productCode must",getproductavailableplatformcouponnumCall.getString("message"), "验证返回message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_014() {
		Logger.start(true,"获取商品可用的平台优惠券数量-优选商品-优选优惠券");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();

			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			String productId = TestDataManager.getRandomNum(8);

	            createcouponBean.setIsLimitPspProduct(true);
	            
			CreateCouponCall createCouponCall = couponCallService.createPlatformCoupon(createcouponBean);
			
			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall.getBatchCode(), userId);
			
			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);   
			getproductavailableplatformcouponnumBean.setPsp(true);

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
						
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(1,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_015() {
		Logger.start(true,"获取商品可用的平台优惠券数量-优选优惠券-普通商品");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();

			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			String productId = TestDataManager.getRandomNum(8);
		
	            createcouponBean.setIsLimitPspProduct(true);
	            
			CreateCouponCall createCouponCall = couponCallService.createPlatformCoupon(createcouponBean);
			
			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall.getBatchCode(), userId);
			
			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);   
			getproductavailableplatformcouponnumBean.setPsp(false);

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
						
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(0,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_getProductAvailablePlatformCouponNum_016() {
		Logger.start(true,"获取商品可用的平台优惠券数量-普通优惠券-优选商品");
		try {
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();
			CouponServiceCallServiceV2 CouponServiceCallServiceV2 = new CouponServiceCallServiceV2();

			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();	
			String productId = TestDataManager.getRandomNum(8);
			 List<String> productIds = new ArrayList<String>();
			 productIds.add(productId);
			 productIds.add("qaffsfsewrwer");
			 productIds.add("qaffsfswerwqerqwrqw");
	            createcouponBean.setProductIds(productIds);
	            
			CreateCouponCall createCouponCall = couponCallService.createPlatformCoupon(createcouponBean);
			
			Integer userId=TestDataManager.getRandomIntNum(8);
			String couponCode = CouponServiceCallServiceV2.receiveCouponInfo(createCouponCall.getBatchCode(), userId);
			
			Thread.sleep(3*1000);
			
			List<Integer> categoryIds = new ArrayList<>();			
			categoryIds.add(111);	
			categoryIds.add(222);	
			categoryIds.add(333);	
			
			getproductavailableplatformcouponnumBean.setUserType(1);
			getproductavailableplatformcouponnumBean.setUserId(userId);
			getproductavailableplatformcouponnumBean.setCategoryIds(categoryIds);
			getproductavailableplatformcouponnumBean.setPlatformId(1);
			getproductavailableplatformcouponnumBean.setCountryId(1);    
			getproductavailableplatformcouponnumBean.setSellerId(createcouponBean.getOperatorId());
			getproductavailableplatformcouponnumBean.setProductCode(productId);   
			getproductavailableplatformcouponnumBean.setPsp(true);

			getproductavailableplatformcouponnumCall.setData(getproductavailableplatformcouponnumBean);
			getproductavailableplatformcouponnumCall.callService();
						
			JsonObject result = getproductavailableplatformcouponnumCall.getJsonObject().get("data").getAsJsonObject();
  			Logger.verifyEquals(1,result.get("quantity").getAsInt(), "验证返回quantity");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}